import type { RoutesMap } from "./types";

// !!!!! 注意：name要与path相同

// 登录的所有用户都有此页面权限
export const loginRoutesMap: RoutesMap = new Map([
  [
    "home",
    {
      path: "/home",
      component: () => import("views/home/home.vue"),
      name: "Home",
      meta: {
        title: "首页",
      },
    },
  ],
  [
    "notfound",
    {
      path: "/:pathMatch(.*)",
      name: "NotFound",
      redirect: "/home",
    },
  ],
]);

/**
 * @description: 根据后台返回的菜单权限进行匹配
 * key: 需要与权限接口返回值的attributes.perms相同
 * value: path与name，除了/，其他要相同，否则可能跳转异常
 */
export const routesMap: RoutesMap = new Map([
  // 账号申请
  [
    "acc_application",
    {
      path: "/accApp",
      component: () =>
        import(
          "@/views/account_application/application/account-application.vue"
        ),
      name: "AccApp",
      meta: {
        title: "账号申请",
      },
    },
  ],
  [
    "acc_logout",
    {
      path: "/accLogout",
      component: () =>
        import("@/views/account_application/logout/account-logout.vue"),
      name: "AccLogout",
      meta: {
        title: "账号注销",
      },
    },
  ],
  [
    "acc_record",
    {
      path: "/accRecord",
      component: () =>
        import("@/views/account_application/record/account-record.vue"),
      name: "AccRecord",
      meta: {
        title: "申请记录",
      },
    },
  ],
  // 权限管理
  [
    "sys_user",
    {
      path: "/sysUser",
      component: () => import("views/manage/user/user.vue"),
      name: "SysUser",
      meta: {
        title: "用户管理",
      },
    },
  ],
  [
    "sys_role",
    {
      path: "/sysRole",
      component: () => import("views/manage/role/role.vue"),
      name: "SysRole",
      meta: {
        title: "角色管理",
      },
    },
  ],
  [
    "sys_dept",
    {
      path: "/sysDept",
      component: () => import("views/manage/organization/organization.vue"),
      name: "SysDept",
      meta: {
        title: "组织架构",
      },
    },
  ],
  [
    "sys_log",
    {
      path: "/sysLog",
      component: () => import("views/manage/log/log.vue"),
      name: "SysLog",
      meta: {
        title: "操作日志",
      },
    },
  ],
  [
    "sys_menu",
    {
      path: "/sysMenu",
      component: () => import("views/manage/menu/menu.vue"),
      name: "SysMenu",
      meta: {
        title: "菜单管理",
      },
    },
  ],
]);
